// 封装和文章相关的接口函数
import { request } from "@/utils";
// 获取频道列表
export const getChannelAPI = () => {
  return request.get("/channels");
};
// 提交文章表单
export const createArticleAPI = (data) => {
  return request.post("/mp/articles?draft=false", data);
};

// 获取文章列表

export const getArticleListAPI = (params) => {
  return request.get("/mp/articles", { params });
  // return request({
  //   method: "get",
  //   url: "/mp/articles",
  //   params,
  // });
};

// 删除文章
export const delArticleAPI = (id) => {
  return request.delete(`mp/articles/${id}`);
};
// 获取文章详情
export const getArticleById = (id) => {
  return request.get(`/mp/articles/${id}`);
};
// 更新文章表单
export const updateArticleAPI = (data) => {
  return request.put(`/mp/articles/${data.id}?draft=false`, data);
};
